/* attachment list in messages */
.attachmentFileList {
	> ul > li:not(:last-child) {
		margin-right: 10px;
	}
}

/* attachment in messages */
.attachmentThumbnailList > ul {
	margin-bottom: -15px;
	
	@include screen-sm-up {
		margin-right: -10px;
	}
}

.attachmentThumbnail {
	box-shadow: 0 0 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .24);
	margin-bottom: 15px !important;
	position: relative;
	
	@include screen-sm-up {
		margin-right: 10px !important;
	}
	
	@include screen-xs {
		margin-right: 0 !important;
		width: 100%;
	}
	
	.attachmentThumbnailContainer {
		position: relative;
		padding: 2px 2px 0;
	}
	
	.attachmentThumbnailImage {
		align-items: center;
		background-color: #333;
		display: flex;
		justify-content: center;
		overflow: hidden;
		text-align: center;
		
		@include screen-sm-up {
			height: #{$wcf_option_attachment_thumbnail_height}px;
			width: #{$wcf_option_attachment_thumbnail_width}px;
		}
		
		@include screen-xs {
			max-height: #{$wcf_option_attachment_thumbnail_height}px;
			min-height: 100px;
		}
		
		img {
			backface-visibility: hidden;
			max-width: 100%;
			opacity: .85;
			transform: translate3d(0,0,0);
			transition: .2s ease opacity;
		}
		
		.attachmentThumbnailImageScalable {
			@include screen-xs {
				width: 100%;
			}
		}
	}
	
	.attachmentThumbnailData {
		backface-visibility: hidden;
		background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, .5) 100%);
		bottom: 0;
		left: 2px;
		pointer-events: none;
		position: absolute;
		right: 2px;
		top: 2px;
		transform: translate3d(0, 0, 0);
	}
	
	.attachmentFilename {
		color: #fff;
		bottom: 0;
		overflow: hidden;
		padding: 10px;
		position: absolute;
		text-overflow: ellipsis;
		text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
		transition: .2s ease opacity;
		width: 100%;
		white-space: nowrap;
		
		@include wcfFontHeadline;
	}
	
	.attachmentMetaData {
		color: $wcfContentDimmedText;
		padding: 10px 15px;
		
		li:not(:last-child) {
			margin-right: 10px;
		}
		
		.icon {
			color: inherit;
		}
	}
	
	&:hover {
		.attachmentThumbnailImage {
			img {
				opacity: 1;
			}
		}
		
		.attachmentFilename {
			opacity: 0;
		}
	}
}

/* attachments tab in editor */
.formAttachmentContent {
	> .formAttachmentList {
		display: flex;
		flex-wrap: wrap;
		margin-left: 0 !important;
		
		> li {
			display: flex;
			flex: 0 0 100%;
			margin-bottom: 20px;
			
			> .attachmentTinyThumbnail {
				border-bottom-width: 0;
			}
		}
	}
	
	@include screen-md-up {
		> .formAttachmentList {
			margin-right: -20px;
			
			> li {
				/* Safari sometimes trips over fractional values, causing two
				   items to be exactly 1 pixel wider than the available space.
				   Reserving 21px covers all sort of rounding errors, without
				   being visually noticeable */
				flex: 0 0 calc(50% - 21px);
				max-width: calc(50% - 21px); /* IE fix */
				margin-right: 20px;
			}
		}
	}
	
	> dl {
		margin-top: 0 !important;
		
		> dd > div {
			align-items: center;
			display: flex;
			
			> .button {
				flex: 0 0 auto;
				
				&:not(:first-child) {
					margin-left: 10px;
				}
			}
			
			& + small {
				margin-top: 10px !important;
			}
		}
	}
}

.attachmentTinyThumbnail {
	max-height: 64px;
	max-width: 64px;
}

/* embedded images */
.embeddedAttachmentLink,
.embeddedImageLink {
	border: 1px solid $wcfContentBorderInner;
	display: inline-block;
	max-width: 100%;
	min-height: 48px;
	padding: 2px;
	position: relative;
	
	&::after {
		background-color: rgba(0, 0, 0, .8);
		border-radius: 2px;
		box-shadow: 0 0 0 3px rgba(0, 0, 0, .15);
		bottom: 5px;
		color: white;
		content: $fa-var-search;
		display: block;
		font-family: FontAwesome;
		font-size: 21px;
		font-style: normal;
		font-weight: normal;
		opacity: .5;
		padding: 2px 8px;
		position: absolute;
		right: 5px;
		text-decoration: none;
		transition: .2s ease opacity;
	}
	
	&:hover {
		&::after {
			opacity: .8;
		}
	}
}

.popoverContent .embeddedAttachmentLink,
.popoverContent .embeddedImageLink {
	/* this will also suppress the link being displayed in the browser's "status bar" on hover */
	pointer-events: none;
}
